package com.neutech.running;

import com.neutech.base.Constant;
import com.neutech.base.Sprite;
import com.neutech.util.ImageUtil;

import java.awt.Graphics;
import java.awt.Image;

public class Land extends Sprite {
    private Image image;
    public Land(){
        init();
    }
    /**
     * 陆地图片的初始化
     * */
    public void init(){
        image= ImageUtil.get("land");
        setX(0);
        setY(Constant.WINDOW_HEIGHT - image.getHeight(null));
        setHeight(image.getHeight(null));
    }

    @Override
    public void draw(Graphics g) {
        g.drawImage(image,getX(),getY(),null);
    }

    public void move(){
        setX(getX() - 1);
        if(getX() < Constant.WINDOW_WIDTH- image.getWidth(null)){
            setX(0);
        };

    }



}

